package com.example.springdemo.others.stream;


import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

/**
 * stream流数据读取截断问题
 * @author zhangding
 * @date 2022年8月3日21:16:25
 */
public class StreamReadPro {
    public static void main(String[] args) throws IOException {

        InputStream inputStream = null;
        File file = new File("F://test.txt");
        inputStream = new FileInputStream(file);
        byte[] b=new byte[1024];
        int size = 0;
        while((size=inputStream.read(b,0,800))!=-1){
            String str = new String(b, 0, size, StandardCharsets.UTF_8);

            System.out.println("!!!!!!!!!!!!!!!!!!!!!size =       " +size+ "         888888888888888888888888888" +str);
        }


//
//        Scanner s = new Scanner(inputStream).useDelimiter("\\A");
//        System.out.println(s.hasNext() ? s.next() : "");


    }
}
